<?php
/*
Template Name: 最新产品 - 模板
*/
?>
<?php get_header(); ?>
<!-- Container Begin-->
<div class="container">
  <!-- Content Begin-->
  <div class="content">
      <!-- Site Navigation begin -->
      <div class="breadcrumb">
          <?php include (TEMPLATEPATH . '/breadcrumb.php'); ?>
      </div>
      <!-- Site Navigation end -->
      <!-- Post Content begin -->
      <div class="content_post">
          <?php if ( get_option('wpyou_products_perpage') ) { ?>
              <?php $products_perpage = stripslashes(get_option('wpyou_products_perpage')); ?>
          <?php } else { ?>
              <?php $products_perpage = 18; ?>
          <?php } ?>
          <?php if (get_option('wpyou_products_id')) { $productsid = get_option('wpyou_products_id'); } ?>
          <?php $wp_query = new WP_Query('cat='.$productsid.'&orderby=date&caller_get_posts=1&order=DESC&posts_per_page='.$products_perpage.'&paged='.$paged); ?>
          <?php if (have_posts()) : ?>
              <ul class="showcase">
              	<?php while (have_posts()) : the_post(); ?>
              	<li>
                	<?php if ( get_post_meta($post->ID, 'thumbnail', true) ) { ?>  
                        <?php $thumbnail = get_post_meta($post->ID, 'thumbnail', true); ?>
                            <a title="<?php the_title(); ?>" href="<?php the_permalink() ?>"><img src="<?php echo $thumbnail; ?>" alt="<?php the_title(); ?>" title="<?php the_title(); ?>" /> </a>  
                    <?php
                         } elseif ( (function_exists('has_post_thumbnail')) && (has_post_thumbnail()) ) {
                    ?>
                            <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" ><img src="<?php $thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), array( 215,165 ), false); echo $thumbnail[0]; ?>" alt="<?php the_title(); ?>" title="<?php the_title(); ?>" /></a>
                    <?php } else {?>
                            <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" ><img src="<?php echo catch_post_image(); ?>" alt="<?php the_title(); ?>" title="<?php the_title(); ?>" /></a>
                    <?php } ?>
                    <h3><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>
               </li>
              	<?php endwhile;?>
			</ul>
      	<?php else : ?>
          <div class="post">
              <p><strong>暂无相关信息</strong><br />
              没有找到您所需的信息.给您带来不便,敬请谅解! 请您<a href="<?php echo get_settings('home'); ?>">返回首页<?php echo $langblog;?></a></p>
          </div>
      	<?php endif; ?>
          <div class="clear"></div>
          <!-- Navigation begin -->
          <div class="wpagenavi">
              <?php if(function_exists('wpyou_pagenavi')) { wpyou_pagenavi(9); } ?>
          </div>
          <!-- Navigation end -->
      </div>
      <!-- Post Content end -->
  </div>
  <!-- Content end-->
  <!-- Sidebar Begin-->
  <?php include (TEMPLATEPATH . '/sidebar.php'); ?>
  <!-- Sidebar end-->
</div>
<!-- Container end-->
<?php get_footer(); ?>